﻿using DimensionsHelper.LanguageService.Syntax;

namespace DimensionsHelper.LanguageService.Symbols;

/// <summary>
///     类成员属性符号
/// </summary>
public class PropertySymbol : BindableSymbolWithParameters
{
    internal PropertySymbol(NamedTypeSymbol containingSymbol, PropertySignature signature) :
        base(SymbolKinds.Property, signature, containingSymbol, containingSymbol.ContainingModule)
    {
        if (signature.IsDefault)
        {
            ModifierFlags |= TypeSymbolModifierFlags.Default;
        }

        if (signature.IsReadOnly)
        {
            ModifierFlags |= TypeSymbolModifierFlags.ReadOnly;
        }

        if (signature.IsWriteOnly)
        {
            ModifierFlags |= TypeSymbolModifierFlags.WriteOnly;
        }

        if (signature.IsNullable)
        {
            ModifierFlags |= TypeSymbolModifierFlags.Nullable;
        }
    }


    public override ModuleSymbol? ContainingModule =>
        ContainingSymbol?.ContainingModule as ModuleSymbol;


    public override bool IsProperty => true;
}